{% load static %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>{{ current_cag.cag_name }}-商品列表</title>
    <link rel="stylesheet" type="text/css" href="/static/css/reset.css">
    <link rel="stylesheet" type="text/css" href="/static/css/main.css">

    <style>
        * {
            margin: 0px;
            padding: 0px;
        }

        ul {
            list-style: none;
        }

        #nav {
            height: 50px;
            background-color: #46474a;
        }

        #nav ul li {
            width: 120px;
            float: left;
        }

        #nav ul li a {
            display: block;
            width: 120px;
            height: 50px;
            line-height: 50px;
            text-decoration: none;
            font-size: 18px;
            /* font-weight: bold; */
            color: white;
            text-align: center;
        }

        #nav ul li a:hover {
            background-color: white;
            color: #46474a;
        }

        .dropdown {
            position: relative;
            display: inline-block;
        }

        .dropdown-content {
            display: none;
            position: absolute;
            background-color: #f9f9f9;
            min-width: 160px;
            box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
            padding: 12px 16px;
            z-index: 1;
        }

        .dropdown:hover .dropdown-content {
            display: block;
        }
    </style>
    <style type="text/css">
        li.margin {
            margin-left: 50px;
        }
    </style>

</head>
<body>
<div id="nav">
    <ul>
        <li class="margin"><img src="/static/images/logo.png" style="width: 87.4px;height: 50px;"></li>
        <li><a href="{% url 'purchase_index' %}">购物商城</a></li>
        <li><a href="/moment/">车友圈</a></li>
        <li><a href="/view_power/">充电规划</a></li>
        <li><a href="/chatbot/botmain/">智能客服</a></li>
        <li><a href="/repair/">维修保养</a></li>
        {% if "info" in request.session.keys %}
        <li class="dropdown">
            <a href="#">
                我的</a>
            <div class="dropdown-content">
                <a href="{% url 'show_order' %}" style="color: #46474a;font-size: 17px;">购物订单</a>
                <a href="/repair/list/" style="color: #46474a;font-size: 17px;">维修订单</a>
                <a href="/infomation/" style="color: #46474a;font-size: 17px;">个人信息</a>
                <a href="/signout/" style="color: #46474a;font-size: 17px;">注销</a>
            </div>
        </li>

        {% else %}
        <li><a href="/signin/">登录 / 注册</a></li>
        {% endif %}
    </ul>
</div>
<div class="search_bar clearfix">
    <!-- <a href="/index/" class="logo fl"><img src="/static/images/logo.png"></a> -->
    <div class="guest_cart fr">
        <a href="{% url 'show_cart' %}}" class="cart_name fl">我的购物车</a>
        <div class="goods_count fl">{{ cart_goods_count }}</div>

        <ul class="cart_goods_show">


            {% for cart_goods in cart_goods_list %}
            <li>
                <img src="/static/goods/{{ cart_goods.goods_img }}.jpg" alt="商品图片">
                {{ cart_goods.goods_name }}
                <div>{{ cart_goods.goods_num }}</div>
            </li>
            {% endfor %}

        </ul>

    </div>
</div>

<div class="navbar_con">
    <div class="navbar clearfix">
        <div class="subnav_con fl">
            <h1>全部商品分类</h1>
            <span></span>
            <ul class="subnav">
                {% for cag in categories %}
                <li><a href="{% url 'goods' %}?cag={{ cag.id }}&page=1"
                       class="{{ cag.cag_css }}">{{ cag.cag_name }}</a></li>
                {% endfor %}
            </ul>
        </div>
    </div>
</div>

<div class="breadcrumb">
    <a href="#">当前分类:</a>
    <span></span>
    <a href="#">{{ current_cag.cag_name }}</a>
</div>

<div class="main_wrap clearfix">

    <div class="sort_bar"></div>

    <ul class="goods_type_list clearfix">

        {% for goods in page_data %}
        <li>
            <a href="{% url 'detail' %}?id={{ goods.id }}"><img src="/static/goods/{{ goods.goods_img }}.jpg"></a>
            <div class="operate">
                <h4><a href="{% url 'detail' %}?id={{ goods.id }}">{{ goods.goods_name }}</a></h4>
                <span class="prize">￥{{ goods.goods_price }}</span>
            </div>
        </li>
        {% endfor %}

    </ul>

    <div class="pagenation">

        {% if page_data.has_previous %}
        <a href="{% url 'goods' %}?cag={{ cag_id }}&page={{ page_data.previous_page_number }}">上一页</a>
        {% endif %}

        {% for index in paginator.page_range %}
        {% if index == page_data.number %}
        <a href="{% url 'goods' %}?cag={{ cag_id }}&page={{ index }}" class="active">{{ index }}</a>
        {% else %}
        <a href="{% url 'goods' %}?cag={{ cag_id }}&page={{ index }}">{{ index }}</a>
        {% endif %}
        {% endfor %}

        {% if page_data.has_next %}
        <a href="{% url 'goods' %}?cag={{ cag_id }}&page={{ page_data.next_page_number }}">下一页></a>
        {% endif %}
    </div>
</div>

<div class="footer">
    <div class="foot_link">
        <a href="#">关于我们</a>
        <span>|</span>
        <a href="#">联系我们</a>
        <span>|</span>
        <a href="#">招聘人才</a>
        <span>|</span>
        <a href="#">友情链接</a>
    </div>
    <p>CopyRight © 2016 信息系统高级分析师群 All Rights Reserved</p>
    <p>电话：010-****888 京ICP备*******8号</p>
</div>

</body>
</html>